﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="qljobs.ascx.cs" Inherits="admin_qljobs" %>
<%@ Register Assembly="FredCK.FCKeditorV2" Namespace="FredCK.FCKeditorV2" TagPrefix="FCKeditorV2" %>
<center>
<table width="100%">
    <tr>
        <th>&nbsp;</th>
        <th align="left">
            Thêm Việc Mới</th>
    </tr>
    <tr>
        <td>Miêu tả: </td>
        <td>
            <asp:TextBox ID="des" runat="server" Height="144px" Width="378px" 
                MaxLength="5000" Rows="5" TextMode="MultiLine"></asp:TextBox>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                ControlToValidate="des" ErrorMessage="*">Miêu tả không được để trống</asp:RequiredFieldValidator>
        </td>
    </tr>
    <tr>
        <td colspan="2"><center><asp:Button runat="server" ID="addbt" Text="Thêm" 
                onclick="addbt_Click1"/>
            <asp:HiddenField ID="hdfID" runat="server" />
            </center></td>
    </tr>
</table>
</center>
<br />
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
        AutoGenerateColumns="False" AllowSorting="True"
        CellPadding="4" ForeColor="#333333" GridLines="None"
        PageSize="5" Width="100%" onrowcreated="GridView1_RowCreated" DataKeyNames="id"
        onrowediting="GridView1_RowEditing" 
    onrowcommand="GridView1_RowCommand" 
    DataSourceID="SqlDataSource1">
        <RowStyle BackColor="#EFF3FB" VerticalAlign="Middle" />
        <EmptyDataRowStyle VerticalAlign="Middle" />
        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="White" ForeColor="#459300" HorizontalAlign="Center" />
        <EmptyDataTemplate>
             <asp:Label ID="Label3" runat="server" Text="Chưa có dữ liệu"></asp:Label>
        </EmptyDataTemplate>
        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
        <HeaderStyle BackColor="#57A000" Font-Bold="True" ForeColor="White" />
        <Columns>
            <asp:TemplateField HeaderText="ID" SortExpression="id" Visible="False">
                <EditItemTemplate >
                    <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("id") %>' 
                        Rows="5" TextMode="MultiLine" Width="576px" 
                        MaxLength="5000"></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Bind("description") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="id" HeaderText="ID" SortExpression="id" 
                Visible="False" >
            <ItemStyle ></ItemStyle>
            </asp:BoundField>
            <asp:BoundField DataField="description" HeaderText="Miêu tả" 
                SortExpression="description" >
            <ControlStyle Height="300px" Width="100%" />
            </asp:BoundField>
            <asp:CommandField ButtonType="Button" EditText="Sửa" ShowEditButton="True" />
            <asp:CommandField ButtonType="Button" DeleteText="Xoá"  
                ShowDeleteButton="True" />
        </Columns>
        <EditRowStyle BackColor="#003366" VerticalAlign="Middle" />
        <AlternatingRowStyle BackColor="White" />
    </asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
    ConnectionString="<%$ ConnectionStrings:canhbuomxanhconnectionstring %>" 
    SelectCommand="SELECT * FROM [Jobs]"
    UpdateCommand="UPDATE [Jobs] SET [description] = @description WHERE [id] = @id"
    
    InsertCommand="INSERT INTO [Jobs] ([id], [description]) VALUES (@id, @description)" 
    DeleteCommand="DELETE FROM [Jobs] WHERE [id] = @id" oninserted="SqlDataSource1_Inserted" 
    >
    <UpdateParameters>
        <asp:Parameter Name="description" Type="String" />
        <asp:Parameter Name="id" Type="Int64" />
    </UpdateParameters>
    <InsertParameters>
        <asp:ControlParameter ControlID="hdfID" Name="id" PropertyName="Value" 
            Type="Int64" />
        <asp:ControlParameter ControlID="des" Name="description" PropertyName="Text" 
            Type="String" />
    </InsertParameters>
    <DeleteParameters>
        <asp:Parameter Name="id" Type="Int64" />
    </DeleteParameters>
</asp:SqlDataSource>